home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / cursor.bqr / cursor.bor
Text File  |  1985-09-01  |  3KB  |  95 lines

  1.  
  2.  
  3. {PRODUCT :   TURBO PASCAL                                       NUMBER :   182
  4.  VERSION :   1.0, 2.0, 3.0
  5.       OS :   PC-DOS
  6.     DATE :   April 9, 1985                                        PAGE :   1/2
  7. -------------------------------------------------------------------------------
  8.   TITLE : Cursor Definition
  9. -------------------------------------------------------------------------------
  10.      This is a sample program that demonstrates how to change the cursor
  11.      on an IBM PC.                                                           }
  12.  
  13. Program NoCursor;
  14.  
  15. var
  16.    ch : char;
  17. start,
  18. endcur : integer;
  19.  
  20. procedure SetCursor (StartLine,EndLine : Integer);
  21. {  This procedure does the actual cursor setting thru the TURBO
  22.    INTR procedure                                                }
  23.  
  24. type Registers = record
  25.                  ax,bx,cx,dx,bp,si,ds,es,flags : integer;
  26.                  end;
  27.  
  28. var
  29.    RegPack : Registers;
  30. CxRegArray : Array [1..2] of Byte;
  31.      CxReg : integer absolute CxRegArray;
  32.  
  33. begin
  34.      CxRegArray [2] := Lo (StartLine);
  35.      CxRegArray [1] := Lo (EndLine);
  36.      With RegPack do
  37.           begin
  38.                ax := $0100;          {ah = 1 means set cursor type         }
  39.                bx := $0;             {bx = page number, zero for us        }
  40.                cx := CxReg;          {cx bits 4 to 0 = start line for      }
  41.                                      {Cursor                               }
  42.                                      {cl bits 4 to 0 = end line for cursor }
  43.                intr ($10,RegPack);   {set cursor                           }
  44.           end;
  45. end;
  46.  
  47. procedure BoxCursor;
  48. {  This procedure calls SetCursor to show a block (box) cursor  }
  49.  
  50. begin
  51.      SetCursor (2,5);
  52. end;
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. {PRODUCT :   TURBO PASCAL                                      NUMBER :   182
  68.  VERSION :   1.0, 2.0, 3.0
  69.       OS :   PC-DOS
  70.     DATE :   April 9, 1985                                       PAGE :   2/2
  71. ------------------------------------------------------------------------------
  72.   TITLE : Cursor Definition
  73. ------------------------------------------------------------------------------}
  74.  
  75. procedure NoCursor;
  76. { This procedure calls SetCursor to turn the cursor off                    }
  77.  
  78. begin
  79.      SetCursor (32,0);      {Setting bit 5 turns off cursor                }
  80. end;
  81.  
  82. procedure ULCursor;
  83. { This procedure calls SetCursor to show the 'underscore' cursor           }
  84.  
  85. begin
  86.      SetCursor (6,7);
  87. end;
  88.  
  89.  
  90. begin
  91.      write ('Box:'); BoxCursor; read (kbd, ch); writeln;
  92.      write ('No:'); NoCursor; read (kbd, ch); writeln;
  93.      write ('UL:'); ULCursor; read (kbd, ch); writeln;
  94. end.
  95.